import cv2
import numpy as np

lena = cv2.imread("3/lena_color.jpg")
if lena is not None:
    cv2.imshow("lena_color.jpg", lena)
    [x, y, z] = lena.shape
    bl, gl, rl = cv2.split(lena)

    b = np.zeros((x, y, z), dtype=np.uint8)
    g = np.zeros((x, y, z), dtype=np.uint8)
    r = np.zeros((x, y, z), dtype=np.uint8)

    b[:, :, 0] = bl
    g[:, :, 1] = gl
    r[:, :, 2] = rl

    cv2.imshow("r", r)
    cv2.imshow("g", g)
    cv2.imshow("b", b)
else:
    print("failed to load image")

cv2.waitKey()
cv2.destroyAllWindows()